<?php
/**
 * 发货单处理
 *
 * @category
 * @package
 * @author liuzecheng<liuzecheng@shopex.cn>
 * @version $Id: Z
 */
class erpapi_shop_matrix_vop_request_delivery extends erpapi_shop_request_delivery
{
    /**
     * 发货请求参数
     *
     * @return void
     * @author
     **/
    protected function get_confirm_params($sdf)
    {
      
        $param = parent::get_confirm_params($sdf);
        unset($param['company_name']);unset($param['logistics_no']);
        $param['package_type']  = ($sdf['is_split'] == 1) ? 2 : 1;
        $product_list = array();
        if ($sdf['package_list']){
            $param['package_type'] = 2;
            $package_product_list_merge_logistics_no = $sdf['package_list'];
        }else{ 
          foreach($sdf['orderinfo']['order_objects'] as $order_object){
           if($order_object['oid'] && $order_object['shop_goods_id']!='-1'){ 
           $product = array(
                    'barcode' => $order_object['shop_goods_id'],
                    'amount' => $order_object['quantity']
                );
                $product_list[] = $product;
           }
          }

          $package_product_list = array(
            'package_product_list' => $product_list,
            'transport_no' => $sdf['logi_no'] ? $sdf['logi_no'] : ''
          );
          $package_product_list_merge_logistics_no[] = $package_product_list;
       }
        $param['packages'] = json_encode($package_product_list_merge_logistics_no);

        return $param;
    }

}
